import instance from './requestConfig'
/**
 * user 页面部分
 * @param devId
 */

export function VXLOGIN (password, username) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'VXLOGIN',
      pwd: password,
      phoneNumber: username
    }
  })
}
export function SENDCHECKCODE (phoneNumber, action) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'SENDCHECKCODE',
      action: action,
      phoneNumber: phoneNumber
    }
  })
}
export function CHECKCODE (phoneNumber, checkcode) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'CHECKCODE',
      phoneNumber: phoneNumber,
      checkcode: checkcode
    }
  })
}

export function newUser (pwd, code, cpwd, phoneNumber) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'NEWUSER',
      vxCode: code,
      pwd: pwd,
      cpwd: cpwd,
      phoneNum: phoneNumber
    }
  })
}

export function REBOOT (uid, vid) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'REBOOT',
      uid: uid,
      vid: vid
    }
  })
}
export function VXLOGINOUT (uid) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'VXLOGINOUT',
      uid: uid
    }
  })
}

export function VXDEVLIST (uid, placeCode) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'VXDEVLIST',
      uid: uid,
      begin: 1,
      size: 50,
      placeCode: placeCode
    }
  })
}
export function PLACELIST (uid) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'PLACELIST',
      uid: uid,
      begin: 1,
      size: 80
    }
  })
}

export function VXPLACEADD (uid, place, placeDes, isDefault) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'VXPLACEADD',
      uid: uid,
      place: place,
      placeDes: placeDes,
      isDefault: isDefault
    }
  })
}

export function USERINFO (uid) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'USERINFO',
      uid: uid
    }
  })
}

export function USEFLOW (uid, date) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'USEFLOW',
      uid: uid,
      date: date + '-1'
    }
  })
}

export function PLACEFLOW (placeId, date) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'PLACEFLOW',
      placeId: placeId,
      date: date + '-1'
    }
  })
}

export function DEVFLOW (vid, date) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'DEVFLOW',
      vid: vid,
      date: date + '-1'
    }
  })
}

export function UNNORMALNUM (uid) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'UNNORMALNUM',
      uid: uid
    }
  })
}

export function EXCEDEV (uid) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'EXCEDEV',
      uid: uid
    }
  })
}

export function EDEV (placeCode) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'EDEV',
      placeCode: placeCode
    }
  })
}

export function FLOWINFO (uid) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'FLOWINFO',
      uid: uid
    }
  })
}

export function HAVEDEVNUM (uid) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'HAVEDEVNUM',
      uid: uid
    }
  })
}

export function VXPAYRECOD (uid, begin) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'VXPAYRECOD',
      uid: uid,
      begin: begin,
      size: 4
    }
  })
}
export function VXMDFPWD (uid, pwd, cpwd) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'VXMDFPWD',
      uid: uid,
      pwd: pwd,
      cpwd: cpwd
    }
  })
}
export function VXPLACEDEFAULT (uid, placeCode, place, placeDes, isDeafult) {
  return instance({
    method: 'post',
    url: '/vappws.json',
    params: {
      cmd: 'VXPLACEDEFAULT',
      uid: uid,
      placeCode: placeCode,
      place: place,
      placeDes: placeDes,
      isDeafult: isDeafult
    }
  })
}
export function DEVALLOT (uid, placeCode, vid) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'DEVALLOT',
      uid: uid,
      placeCode: placeCode,
      vid: vid
    }
  })
}
export function VXPlACEDEL (uid, placeCode) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'VXPlACEDEL',
      uid: uid,
      placeCode: placeCode
    }
  })
}
export function VXMDFDEVNAME (uid, vid, nickName) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'VXMDFDEVNAME',
      uid: uid,
      vid: vid,
      nickName: nickName
    }
  })
}
export function VXMDFDEVPWD (uid, vid, pwd) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'VXMDFDEVPWD',
      uid: uid,
      vid: vid,
      pwd: pwd
    }
  })
}
export function VXDEVINFO (devId) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'VXDEVINFO',
      devId: devId
    }
  })
}
export function VXBIND (uid, devId, placeCode, vifiName, vifiPwd) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'VXBIND',
      uid: uid,
      devId: devId,
      placeCode: placeCode,
      vifiName: vifiName,
      vifiPwd: vifiPwd
    }
  })
}
export function OPENDEV (uid, vid) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'VXBIND',
      uid: uid,
      vid: vid
    }
  })
}
export function ALLOTRCD (uid, begin) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'ALLOTRCD',
      uid: uid,
      begin: begin,
      size: 4
    }
  })
}
export function wxpay (uid, payMoney, flow) {
  return instance({
    method: 'get',
    url: '/vxpay',
    params: {
      uid: uid,
      payMoney: payMoney,
      flow: flow
    }
  })
}
export function WXCONFIG (uid, payMoney, flow) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'WXCONFIG',
      payUrl: location.href.split('#')[0]
    }
  })
}

export function ALLOTFLOW (uid, placeCode, flow) {
  return instance({
    method: 'get',
    url: '/vappws.json',
    params: {
      cmd: 'ALLOTFLOW',
      uid: uid,
      placeCode: placeCode,
      flow: flow
    }
  })
}
